# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=black
pkgver=22.6.0
pkgrel=0
pkgdesc="The uncompromising Python code formatter"
url="https://github.com/psf/black"
license="MIT"
arch="noarch"
depends="python3 py3-click py3-attrs py3-tomli py3-platformdirs py3-typed-ast py3-regex
	py3-pathspec py3-typing-extensions py3-mypy-extensions"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-parameterized py3-aiohttp"
source="https://files.pythonhosted.org/packages/source/b/black/black-$pkgver.tar.gz
	remove-setuptools_scm.patch
	"

build() {
	python3 setup.py build
}

check() {
	# temporary installation for testing
	python3 setup.py install --root="$PWD"/test_install --skip-build

	ulimit -n 2048 # running out of file descriptors

	PATH="$PWD/test_install/usr/bin:$PATH" \
		PYTHONPATH="$(echo $PWD/test_install/usr/lib/python3*/site-packages)" \
		pytest -m "not without_python2"
}

package() {
	python3 setup.py install --root="$pkgdir" --skip-build
}

sha512sums="
8d1e2871abb4872d6e368b62e07112c791e8626154ae323639414393f1fbffdab219389e89785f46cc2cda23a4109a2de9c5b672bdd76ff42cc860fd21472f2c  black-22.6.0.tar.gz
e958f2a78b5aa9ce429a7cf0aaa31025dc0a5f05df6d5b5deb660aab336dd3eb3d9f180ee10531e2e05005b9a7348561f3021f0f3ea923d3cd45360ed4f7cdd4  remove-setuptools_scm.patch
"
